<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
        xxxxx,禁止文字被选中
    </div>


    <script>
        //禁止选中文本
        document.onselectstart =function(e){
            e.preventDefault();
        }
        // document.addEventListener("selectstart",function(e){
        //     e.preventDefault();
        // })
        

        //禁止鼠标右键.
        document.addEventListener("contextmenu",function(e){
            e.preventDefault();
        })
        
    </script>
</body>
</html>